/*
 * @Author: 晟松
 * @Date: 2021-12-07 15:41:46
 * @LastEditors: 晟松
 * @LastEditTime: 2022-01-24 17:37:11
 * @FilePath: \mini-vue3d:\Code\node\koa2\volunteer-service\src\main\config\enums.js
 * @Description: 使用js语法实现enum的效果，可在数据库中存储数字，而在这里知道这个数字表示什么意思
 */

// 身份
let identity;
// 志愿服务状态，stateTrans为state转换的中文
let state, stateTrans;

// 性别
let gender;
// 年级
let grade;
// 辅导员管理层级
let managementLevel;
/**
 * @description: 实现身份的enum,用于login表存储身份
 * @param {*} identity
 * @return {*} 
{
    "1": "school",
    "4": "COMMUNITY",
    "8": "STUDENT",
    "16": "RESIDENT",
    "school": 1,
    "COMMUNITY": 4,
    "STUDENT": 8,
    "RESIDENT": 16
} 
 */
(function (identity) {
    identity[(identity["school"] = 1)] = "school";
    identity[(identity["community"] = 4)] = "community";
    identity[(identity["student"] = 8)] = "student";
    identity[(identity["resident"] = 16)] = "resident";
    // identity[identity["COUNSELOR"] = 32] = "COUNSELOR";
})(identity || (identity = {}));

/**
 * @description: 志愿服务状态
 * @param {*} state
 * @return {*}
 */
(function (state) {
    state[(state["pendingReview"] = 1)] = "pendingReview";
    state[(state["returned"] = 2)] = "returned";
    state[(state["approved"] = 4)] = "approved";
    state[(state["alreadyClaimed"] = 8)] = "alreadyClaimed";
    state[(state["pendingFeedback"] = 16)] = "pendingFeedback";
    state[(state["toBeEvaluated"] = 32)] = "toBeEvaluated";
    state[(state["completed"] = 64)] = "completed";
    state[(state["cancelled"] = 128)] = "cancelled";
    state[(state["expired"] = 256)] = "expired";
    // state[state["completed"] = 1024] = "completed";
})(state || (state = {}));

(function (stateTrans) {
    stateTrans[(stateTrans["等待审核"] = 1)] = "等待审核";
    stateTrans[(stateTrans["被退回"] = 2)] = "被退回";
    stateTrans[(stateTrans["待领取"] = 4)] = "待领取"; //即审核通过
    stateTrans[(stateTrans["已被领取"] = 8)] = "已被领取";
    stateTrans[(stateTrans["待反馈"] = 16)] = "待反馈";
    stateTrans[(stateTrans["待评价"] = 32)] = "待评价";
    stateTrans[(stateTrans["已完成"] = 64)] = "已完成";
    stateTrans[(stateTrans["已取消"] = 128)] = "已取消";
    stateTrans[(stateTrans["已过期"] = 256)] = "已过期";
    // stateTrans[stateTrans["completed"] = 1024] = "completed";
})(stateTrans || (stateTrans = {}));

/**
 * @description: 性别
 * @param {*} gender
 * @return {*}
 */
(function (gender) {
    gender[(gender["male"] = 1)] = "male";
    gender[(gender["female"] = 4)] = "female";
    gender[(gender["unknown"] = 8)] = "unknown";
})(gender || (gender = {}));

/**
 * @description: 学生的年级，按照四年算，研究生单独拎出来
 * @param {*} grade
 * @return {*}
 */
(function (grade) {
    grade[(grade["freshman"] = 1)] = "freshman";
    grade[(grade["sophomore"] = 2)] = "sophomore";
    grade[(grade["junior"] = 3)] = "junior";
    grade[(grade["senior"] = 4)] = "senior";
    grade[(grade["postgraduate"] = 8)] = "postgraduate";
})(grade || (grade = {}));

/**
 * @description:
 * @param {*} managementLevel
 * @return {*}
 */
(function (managementLevel) {
    managementLevel[(managementLevel["school"] = 1)] = "school";
    managementLevel[(managementLevel["college"] = 4)] = "college";
})(managementLevel || (managementLevel = {}));

export default { identity, state, stateTrans, gender, grade, managementLevel };
